# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=libteam
pkgver=1.31
pkgrel=5
pkgdesc="Library for controlling team network device"
url="http://libteam.org"
arch="all"
license="LGPL-2.1-or-later"
makedepends="autoconf automake libtool libnl3-dev libdaemon-dev jansson-dev
	dbus-dev linux-headers bsd-compat-headers doxygen swig python3-dev"
subpackages="$pkgname-dev $pkgname-doc py3-$pkgname-pyc py3-$pkgname:_py3"
source="$pkgname-$pkgver.tar.gz::https://github.com/jpirko/libteam/archive/v$pkgver.tar.gz
	fix-fd_set.patch
	memcpy-memset-implicit-declaration.patch
	fix-redefinition-struct-ethhdr.patch
	swig4.1.patch
	implicit-function-decl.patch
	"

prepare() {
	default_prepare
	autoreconf -vfi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-static
	make

	cd binding/python
	python3 setup.py build
}

package() {
	make DESTDIR="$pkgdir" install

	cd binding/python
	python3 setup.py install --root "$pkgdir" -O1
}

_py3() {
	pkgdesc="Python Bindings for libteam"

	amove usr/lib/python3*
}

sha512sums="
1382cc3b0a2d0211f33e506e8a6fd8a1847398fa5bba56abfc959da70bcc8417cf1dba9e26a777da5729eb237f51a66b3f9cfa33fb830ed684aa076f4c8cec9e  libteam-1.31.tar.gz
83f8dd77cfed0f815bc0cb2aa4af25883a02567dbb35b59016d7f3a30f162e63155996d21216424f0ea4efa8e92f8f9526a018a892533c3c7dd7c7ba12b46a44  fix-fd_set.patch
1279c164960b6215e9bb9f3ee161ef9ac6a38b8066d4a1031996b8067031b9b19404681ebecf3492a26b1215ec2eaaddecae3370ec25e2593dc3ca7dc5f8ead7  memcpy-memset-implicit-declaration.patch
db2f374018a8b60c099e5b41abf5a9d20912bddc0436788b246815459c97498fb47d237376f87a623438f2f48d486d91d65fe5b49aeeabc83cbd41bdb66d7bfc  fix-redefinition-struct-ethhdr.patch
50c39a8264e7adb6313b2109ef68d18cb3f46c67e88d6cd3f393c26738fe7d4e34fd7b9dba0a4e0a9d6a2da793d847741f5fe1069f82319adfb4f3d884ffece8  swig4.1.patch
35ff644b50feae4e23d5527c6cf173c0450b02c0e737c33a4a4d0041c644ff8cf7f33e92de2491e5f4de6d96b5342ba3b04228b7101d1eb551b961b37a62f690  implicit-function-decl.patch
"
